//
//  ZWBaseViewController.swift
//  SwiftFreshBeen
//
//  Created by Apple on 16/12/22.
//  Copyright © 2016年 zhouwnegang. All rights reserved.
//

import UIKit

class ZWBaseViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
    
        self.view.backgroundColor = hm_randomColor
        
        setNavBar() 
        
    }
    
    
    private  func setNavBar() {

        //设置扫一扫
        //firsttab_barcode_22x22_
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(imageName: "firsttab_barcode_22x22_", target: self, action: #selector(scanOneScan))
        
    }
    
    //MARK:实现扫一扫功能
    @objc private func scanOneScan() {
        
        print("扫一扫");
        
        let storyBord = UIStoryboard(name: "ZWScanViewController", bundle: nil)
        
        let scanVc = storyBord.instantiateViewController(withIdentifier: "ZWScanViewController")
        
        self.navigationController?.pushViewController(scanVc, animated: true)

//        self.addChildViewController(scanVc)
//        self.view.addSubview(scanVc.view)
//        scanVc.view.frame = self.view.frame
//        
//        scanVc .didMove(toParentViewController: self)
        
    }
    

}
